import { useResponseSuccess } from '~/utils/response';

export default eventHandler(async (event) => {
  const id = getRouterParam(event, 'id');
  const body = await readBody(event);

  // 模拟更新模板
  const updatedTemplate = {
    id,
    ...body,
    updateTime: new Date().toISOString().replace('T', ' ').substring(0, 19),
  };

  return useResponseSuccess({
    message: '更新成功',
    data: updatedTemplate,
  });
});
